package EnterpriseAlgorithm.Stack_Queue.Code.ReverseStackRecursion;

import java.util.Stack;

public class Example {
    public static void main(String[] args) {
        Solution solution = new Solution();
        // 创建栈 并添加元素
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);
        // 调用前输出
        while (!stack.isEmpty()) {
            System.out.print(stack.pop() + " ");
        }
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);
        System.out.println();
        // 调用方法
        solution.reverseStack(stack);
        // 返回结果
        while (!stack.isEmpty()) {
            System.out.print(stack.pop() + " ");
        }
    }
}
